
 1000  *SAVE S.WILDCAT
 1010  *--------------------------------
 1020  CatLnCnt   .EQ $EB Catalog Linecount
 1030  FType      .EQ $EC Hold looked-up filetype
 1040  FName1     .EQ $EE Hold FNAME shell 1st char
 1050  CatNmLen   .EQ $ED CatName check-length=30
 1060  CatPtLen   .EQ $EF CatName print-length=30
 1070  *-----(1)----
 1080         .PH $9D26 In CMDTBL, command addresses,
 1090         .DA TYPE-1 change Integer CHAIN to TYPE
 1100         .PH $9D3E In CMDTBL, change address to
 1110         .DA NewDOCAT-1 new DOCAT in POSITION code
 1120  *-----(2)----
 1130         .PH $9FA8 In ECHO, change old COUT ref
 1140         .DA #$CA was JSR $9FC5 now JSR $9FCA
 1150         .PH $9FC5 Cleanup CDI COUT and CROUT
 1160  BlankOUT LDA #" " and add BLANK out routine
 1170         .DA #$2C fake BIT-NOP on fall-thru
 1180  CROUT  LDA #$8D  DOS vectored CROUT; same loc
 1190  COUT   JMP ($36) DOS vectored COUT; new loc
 1200         .PH $A710 In PRTERROR, change old COUT
 1210         .DA #$CA was JSR $9FC5 now JSR $9FCA
 1220  *-----(3)----
 1230         .PH $A186 Cleanup DOCMD; X=0 in NewDOCAT
 1240         LDY $AA5F CMDINDX
 1250         LDA $9D1F,Y CMDTBL+1; use Y instead of X
 1260         PHA
 1270         LDA $9D1E,Y CMDTBL
 1280         PHA
 1290         RTS
 1300         NOP
 1310  *-----(4)----
 1320         .PH $A56E Replace old DOCAT code:
 1330  OldDOCAT JMP NewDOCAT To allow for direct entry
 1340  PrtTYPE LDA FType Print looked-up filetype
 1350         JSR COUT and
 1360         JMP BlankOUT a blank
 1370         NOP
 1380  *-----(5)----
 1390         .PH $A5DD Replace old POSITION code:
 1400  NewDOCAT LDA $AA75 FNAME set by CATALOG command
 1410         STA FName1 save first byte, then zero
 1420         STX $AA75 to avoid buffer allocation
 1430         LDA #13 FM WildCAT Function Code
 1440         JMP $A2AA CMDHNDL2 routine, per usual
 1450         NOP
 1460  *-----(6)----
 1470         .PH $A921 DIR [string] [,Dn] [,Sn]
 1480         .DA #$60,$70 ->First comma: is NOT optional
 1490         .PH $A929 CATALOG [string] <[,Dn] [,Sn]>
 1500         .DA #$60 ->Must be CATALOG,D1 or DIR,D2
 1510         .PH $AAE3 In FM function table, "borrow"
 1520         .DA WildCAT-1 otherwise useless address
 1530         .PH $AB10 Change range check from 13 for
 1540         CMP #14 above now USEFULL address
 1550  *-----(7)----
 1560         .PH $A4F0 Replace Integer CHAIN code
 1570  PrtLOCK LDA #" " blank=unlocked
 1580         LDX $B4C8,Y Catalog Filetype entry
 1590         BPL ToPrint
 1600         LDA #"*" *=locked
 1610  ToPrint JMP COUT Print " " or "*" indicator
 1620  *-----(8)----
 1630         .PH $A9FD Shorten NO BUFFER[S AVAILABLE]
 1640         .AS -"R" to free 11 bytes for ToPrtDec:
 1650  ToPrtDec BIT $E006 Check which Basic...
 1660         BMI ToInt Integer or
 1670         JMP $ED24 Applesoft; use appropriate
 1680  ToInt JMP $E51B print decimal routine
 1690  *-----(9)----
 1700         .PH $A021 Replace JSR ISBASRUN to allow
 1710         NOP  ALL commands entered direct
 1720         NOP  then error msg is redundant so
 1730         NOP  ok to re-use msg space below
 1740         .PH $AA2C Replace NOT DIRECT COMMAND msg
 1750  CkCAT CMP #" " If blank, do regular catalog
 1760         BEQ ToRTS
 1770         LDY #" " Must be single-char filetype
 1780         CPY $AA76 FNAME+1, ie blank afterwards
 1790         BEQ CkType if catalog by filetype; else
 1800         JMP $A6C4 CSYNTAX error
 1810  CkType CMP FType Does filetype match?
 1820  ToRTS RTS
 1830         NOP
 1840         NOP
 1850  *----(10)----
 1860         .PH $AD98
 1870  CATHNDLR JSR AllowENT Allow for non-CDI entry
 1880  WildCAT JSR $ABDC Init File Manager Workarea
 1890         BNE ToRWVTOC
 1900  atADA0 JMP AlowVTOC Allow for non-CDI entry
 1910  atADA3 NOP  Allow for non-CDI entry and
 1920         NOP  alignment
 1930  atADA5 JSR AllowENT Allow for non-CDI entry
 1940  atADA8 JSR AllowENT Allow for non-CDI entry
 1950  atADAB JSR InitCR Init Linecount; output C/R
 1960  *----(11)----
 1970         JSR SKIPLN
 1980         LDX #12
 1990  PrtFreSP LDA FreeMsg-1,X
 2000         JSR COUT Print " FREE SPACE="
 2010         DEX
 2020         BNE PrtFreSP X=0 for PrtFreSP
 2030         JSR FreeSpce Count & print free sectors
 2040         JSR SKIPLN
 2050         JSR SKIPLN
 2060         CLC  Setup for RDNXTDIR to read
 2070         BCC RDNXTDIR first sector; always branch
 2080         NOP  alignment
 2090  atADC9 JSR AllowENT Allow non-CDI, non-FM entry
 2100  RDNXTDIR JSR $B011 RDDIRSEC
 2110         BCS DONEXT2
 2120         LDX #0
 2130  GTRKNUM STX $B39C DIRINDX
 2140         LDA $B4C6,X Track part of T/S list
 2150         BEQ DONEXT2 If End of Catalog, then exit
 2160         BMI DONEXT If Deleted File, then skip it
 2170         LDA $B4C8,X Catalog Filetype
 2180         ASL  ;skip hi-bit LOCK/UNLOCK flag
 2190         LDY #7
 2200  FindTYPE ASL
 2210         BCS GotTYPE
 2220         DEY
 2230         BNE FindTYPE
 2240  GotTYPE LDA $B3A7,Y From filetype table,
 2250         STA FType save looked-up filetype
 2260         LDY #30 Check CatName length and
 2270         STY CatPtLen Print CatName length
 2280         BNE CkFNAME always BNE
 2290  *----(12)----
 2300  AlowVTOC JSR AllowENT Allow for non-CDI entry
 2310  ToRWVTOC JSR $AFF7 RWVTOC read VTOC
 2320         BCC atADAB always; carry set=I/O ERROR
 2330  *----(13)----
 2340         NOP  ;alignment
 2350         NOP
 2360  PrtCAT LDY $B39C Restore Y from DIRINDX
 2370         JSR PrtLOCK Print Lock indicator
 2380         JSR PrtTYPE Print filetype and BlankOUT
 2390         LDX $B4E7,Y Filesize
 2400         LDA $B4E8,Y Filesize+1
 2410         JSR ToPrtDec Print "true" filesize
 2420         LDY #7 "Poke" CH with 7 to "tab"
 2430         STY $24 over for filename spacing
 2440         LDX $B39C Restore X from DIRINDX
 2450  PrtFN LDA $B4C9,X Print Catalog Filename
 2460         JSR InvCOUT with optional conversions
 2470         INX
 2480         DEC CatPtLen CatName print length
 2490         BNE PrtFN
 2500         JSR SKIPLN
 2510  DONEXT JSR $B230 NXTDIREN...atAE25
 2520         BCC GTRKNUM
 2530         BCS RDNXTDIR
 2540  DONEXT2 JMP $B37F NOERROR....atAE2C
 2550  SKIPLN DEC CatLnCnt Linecount..atAE2F
 2560         BNE ToCR If not zero, C/R & return
 2570         JSR WaitCQ else wait for keypress
 2580         BEQ DONEXT2 If Ctrl-Q, exit to NOERROR
 2590  InitCR LDA #22-1 else setup for next 22 lines
 2600         STA CatLnCnt in line count
 2610  ToCR JMP CROUT DOS vectored C/R out
 2620  *----(14)----
 2630  CkFNAME LDA FName1 Holds FNAME first character
 2640         CMP #"^" Wildcard string?
 2650         BEQ DoWild yes...maybe
 2660         JSR CkCAT Regular or by filetype?
 2670         BEQ PrtCAT yes...else
 2680         BNE DONEXT none of the above
 2690  DoWild STY CatNmLen CatName length=30, for NotEQ
 2700         LDY #1 Decr'd to 0; indexes FNAME
 2710  NotEQ DEC CatNmLen Checked all 30 chars?
 2720         BMI DONEXT Yes; no match, do next CatName
 2730  BackDown DEX  Backdown to string match start
 2740         DEY  Backdown to 0, ie. FNAME start
 2750         BNE BackDown
 2760  YesEQ INY  First Y=1, then on past "^"
 2770         INX
 2780         LDA $AA75,Y FNAME
 2790         CMP #" " If blank then wildcard EOS and
 2800         BEQ PrtCAT still =, so we have a match!
 2810         CMP $B4C9,X FNAME = CatName?
 2820         BEQ YesEQ
 2830         INX  No, setup X to backdown 1 past
 2840         BNE NotEQ string match start; always BNE
 2850         NOP
 2860  *----(15)----
 2870         .PH $BA69 Catalog Free Space Patch
 2880  FreeSpce STX $44 X=0
 2890         STX $45 Init Free Sec Count var
 2900         LDY #50*4 VTOC entries * entry length
 2910  NxBitMap LDA $B3F2,Y BITMAP-1 in VTOC buffer
 2920  CkFree ASL  ;shift hi-order bit into CARRY
 2930         BCC CkMore In use, so check if any more
 2940         INC $44 Incr free sector count
 2950         BNE CkFree Zero means > 255, so
 2960         INC $45 incr "page" part of word
 2970  CkMore BNE CkFree More bits in same byte?
 2980         DEY  decr index to next VTOC byte
 2990         BNE NxBitMap All done?
 3000         LDX $44 Yes, so setup count in X & A
 3010         LDA $45 for decimal print via
 3020         JMP ToPrtDec one of the BASICs
 3030  *----(16)----
 3040  WaitCk79 JSR $FCA8 Monitor WAIT routine
 3050         DEC $55 Decr char cnt
 3060         BNE $BA10 Fortuitous RTS; else fall thru
 3070  InitLine LDA #79 TYPE prolog/setup
 3080         STA $55 Init printer 80-col char cnt
 3090         JMP CROUT
 3100         NOP
 3110  *----(17)----
 3120         .PH $B6B3
 3130  TYPE JSR $A2A3 DOS Open file
 3140  DoInitLn JSR InitLine Init char cnt & CROUT
 3150  ToRead JSR $A68C DOS Read char
 3160         BEQ ToWaitCQ EOF maybe...Ctrl-Q quit?
 3170         CMP #$8D Carriage return?
 3180         BEQ DoInitLn Yes, handle immediately
 3190         JSR InvCOUT Optional Ctrls & Hibit=0 INV
 3200         LDA $F1 Applesoft SPEED=nn byte
 3210         JSR WaitCk79 Wait SPEED; 79 chars yet?
 3220         LDA $C000 Has a key been pressed?
 3230         BPL ToRead No, read on
 3240         STA $C010 Reset keyboard strobe
 3250  ToWaitCQ JSR WaitCQ Wait keypress, check Ctrl-Q?
 3260         BNE ToRead If not Ctrl-Q, read on
 3270         JMP $A2FC DOS Close, Deallocate, Exit
 3280  *----(18)----
 3290  InvCOUT TAY  If < $80, then hibit off
 3300         BPL SetINV so set inverse flag & convert
 3310         CMP #$A0 Ctrl-char?
 3320         BCS CkLoCase No
 3330         BIT $EA Usually, loc 234 contains 0:
 3340         BMI CkLoCase POKE 234,255 skips conversion
 3350  SetINV LSR $32 Set Inverse by shifting 0 into
 3360         LSR $32 INVFLG first 2 bits; set carry
 3370         AND #$3F Turn off 1st 2 bits maps down
 3380         ADC #$1F maps up into hibit-on part of
 3390         EOR #$E0 upper-case screen-char range
 3400  CkLoCase CMP #$E0 Lower-case?
 3410         BCC ToCOUT No; but POKE -18700,223 or
 3420         AND #$FF B6F4:DF shifts l.c. to U.C.
 3430  ToCOUT JSR COUT DOS vectored COUT
 3440         LDA #$FF
 3450         STA $32 Set normal video; always
 3460         RTS
 3470  *----(19)----
 3480         .PH $B78D Wait keypress; check Ctrl-Q
 3490  WaitCQ JSR $FD0C Monitor RDKEY
 3500         CMP #$91 Was it Ctrl-Q?
 3510         RTS
 3520  *----(20)----
 3530         .PH $B3AF Replace: DISK VOLUME inverted
 3540  FreeMsg .AS -"=ECAPS EERF " with FREE SPACE=
 3550  *----(21)----
 3560         .PH $A884 Setup FName1 for "irregular"
 3570  AllowENT LDA #" " entry into CATALOG code
 3580         STA FName1 Force blank at CkFNAME above
 3590         CLC  For possible RDNXTDIR entry
 3600         RTS
 3610  DOSCMDS .AT 'INIT' Move down DOSCMDS table and
 3620         .AT 'LOAD' re-use the freed space above
 3630         .AT 'SAVE'
 3640         .AT 'RUN'
 3650         .AT 'TYPE' was CHAIN
 3660         .AT 'DELETE'
 3670         .AT 'LOCK'
 3680         .AT 'UNLOCK'
 3690         .AT 'CLOSE'
 3700         .AT 'READ'
 3710         .AT 'EXEC'
 3720         .AT 'WRITE'
 3730  atA8BF .AT 'DIR' was POSITION; for CAT:43 41 D4
 3740  *----(22)----
 3750         .PH $9FFB In Command Interpreter PARSE
 3760         LDA DOSCMDS,Y DOSCMDS table ref. was $A884
 3770         .PH $9FED Only 2 references to DOSCMDS
 3780         EOR DOSCMDS,Y DO THIS AFTER ABOVE CHANGES!
 3790  *--------------------------------

